package com.xsh.gls.service.impl;

import com.xsh.gls.mapper.CompanyMapper;
import com.xsh.gls.pojo.Company;
import com.xsh.gls.pojo.Order;
import com.xsh.gls.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

/**
 * @author shkstart
 * @date 2019/1/23 - 15:31
 */

@Service
public class CompanyServiceImpl implements CompanyService {
    @Autowired
    private CompanyMapper companyMapper;

    @Override
    public List<Company> select() {
        return companyMapper.select();
    }
    public List<Company> getByAll(String cName, Integer cType, String pName, String cAddress, String pPhone) {
        return companyMapper.getByAll(cName, cType, pName, cAddress, pPhone);
    }

    @Override
    public Company selectByNT(String cName, Integer cType) {
        return companyMapper.selectByNT(cName, cType);
    }

    @Override
    public boolean insert(Company company) {
        boolean flag = false;
        if (companyMapper.insert(company)>0){
            flag = true;
        }
        return flag;
    }

    @Override
    public Company selectAll(Integer id) {
        return companyMapper.selectAll(id);
    }

    @Override
    public boolean deleteByPrimaryKey(Integer id) {
        boolean flag = false;
        if (companyMapper.deleteByPrimaryKey(id)>0){
            flag = true;
        }
        return flag;
    }

    @Override
    public boolean updateByPrimaryKey(Company company) {
        boolean flag = false;
        if (companyMapper.updateByPrimaryKey(company)>0){
            flag = true;
        }
        return flag;
    }

    @Override
    public List<Company> selectByType(Integer cType) {
        return companyMapper.selectByType(cType);
    }


}
